package cn.stazxr.pane;

import javax.swing.*;
import java.awt.*;

/**
 * Package: cn.stazxr.pane
 * ClassName: JSplitPaneTest
 *
 * @Author: stazxr
 * @Create: 2023/12/15
 * @Version: v1.0
 **/
public class JSplitPaneTest {
    public static void main(String[] args) {
        JFrame frame = new JFrame("JSplitPane");
        frame.setBounds(500, 500, 600, 300);

        JSplitPane pane = new JSplitPane();
        pane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);  //设定为横向分割
        //横向分割之后，我们需要指定左右两边的组件
        pane.setLeftComponent(new JPanel() {{setBackground(Color.ORANGE);}});
        pane.setRightComponent(new JPanel() {{setBackground(Color.PINK);}});

        frame.add(pane);
        frame.setVisible(true);
    }
}
